//引用
//调用api
//const  mypackage = require('./mypackage')
//mypackage.say('我是控制方')
//模块即包，包即模块
//const  fs=require('fs')
//同步
/*fs.writeFile('./fs.txt','lizupeng',(e)=>{
    //错误原则
    if (e) {
        console.error(e)
        return;
    }
    console.log('success')
})*/
//同步
//fs.writeFileSync('./fs.txt',new Date())
/*异步
fs.readFile('./fs.txt',(e,data)=>{
    if (e) {
        console.error(e)
        return
    }
    console.log(data.toString())
})*/
/*同步
let data = fs.readFileSync('./fs.txt')
console.log(data.toString())*/
/*try {
    let data = fs.readFileSync('./fs1.txt')
    console.log(data.toString())
}catch (e) {
    console.error('出错咯${e.message}')
}*/
/*
fs.readFile('a',function () {
    fs.readFile('b',function () {

    })
})
fs.readFile('c',function () {

})
顺序为a,c,b*/
const path = require('path')
console.log(path.join('a','../b','c'))//路径为b/c
console.log(path.basename('f:/a.txt'))//获取文件名
console.log(path.dirname('f:/a.txt'))//获取文件路径
console.log(path.basename('f:/a.txt','.txt'))//获取无后缀文件名
console.log()
